import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ManagementTypeVO, ManagementTypeForm, ManagementTypeQuery } from '@/api/germbank/partner/management/types';

/**
 * 查询管理团队管理列表
 * @param query
 * @returns {*}
 */

export const listManagement = (query?: ManagementTypeQuery): AxiosPromise<ManagementTypeVO[]> => {
  return request({
    url: '/germbank/management/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询管理团队管理详细
 * @param id
 */
export const getManagement = (id: string | number): AxiosPromise<ManagementTypeVO> => {
  return request({
    url: '/germbank/client/' + id,
    method: 'get'
  });
};

/**
 * 新增管理团队管理
 * @param data
 */
export const addManagement = (data: ManagementTypeForm) => {
  return request({
    url: '/germbank/client',
    method: 'post',
    data: data
  });
};

/**
 * 修改管理团队管理
 * @param data
 */
export const updateManagement = (data: ManagementTypeForm) => {
  return request({
    url: '/germbank/client',
    method: 'put',
    data: data
  });
};

/**
 * 删除管理团队管理
 * @param id
 */
export const delManagement = (id: string | number | Array<string | number>) => {
  return request({
    url: '/germbank/client/' + id,
    method: 'delete'
  });
};

/**
 * 状态修改
 * @param clientId 商业伙伴id
 * @param status 状态
 */
export function changeStatus(clientId: string, status: string) {
  const data = {
    clientId,
    status
  };
  return request({
    url: '/germbank/client/changeStatus',
    method: 'put',
    data: data
  });
}

// 刷新联系我们缓存
export function refreshCache() {
  return request({
    url: '/system/dict/type/refreshCache',
    method: 'delete'
  });
}
